<template>
  <section>
    <el-row v-if="pageType === 'ppts'">
      <ppt-ad :ad="currAd"></ppt-ad>
    </el-row>
    <el-row v-else-if="pageType === 'image'">
      <image-ad :ad="currAd"></image-ad>
    </el-row>
    <el-row v-else-if="pageType === 'images'" style="background-color: #fff;padding: 20px">
      <images-ad :ad="currAd"></images-ad>
    </el-row>
    <el-row v-else-if="pageType === 'featured'" style="background-color: #fff;padding: 20px">
      <featured-ad :ad="currAd"></featured-ad>
    </el-row>
  </section>
</template>

<script>
  import pptAd from './pptAd'
  import tabAd from './tabAd'
  import imageAd from './imageAd'
  import imagesAd from './imagesAd'
  import featuredAd from './featuredAd'
  export default {
    name: "tabDetail",
    components:{pptAd,tabAd,imageAd,imagesAd,featuredAd},
    props:['tab','item'],
    data(){
      return {
        pageType:null,
        currAd:null
      }
    },
    watch:{
      tab(nv,ov){
        console.log('没有新的？？？',nv)
        if(nv){
          this.pageType=nv.config.baseSet.code
          this.currAd=nv
        }
      },
      item(nv,ov){
        console.log('看更新————————',nv)
      }
    },
    created(){
      console.log(this.tab)
      console.log(this.item)
      this.pageType=this.tab.config.baseSet.code
      this.currAd=this.tab
    },
    methods: {
      // ...mapActions({
      //   fetch: 'fetch'
      // }),
    }
  }
</script>

<style scoped>

</style>
